<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<jsp:include page="/all/base.jsp" />
<html>
<head>
	<script type="text/javascript"
		src="${contextPath}/js/template_submit.js"></script>
	<script type="text/javascript">
        $(function () {
            // _bindControls为绑定控件方法，参数为输入框等控件的ID，提交页面时会用到这些控件
        	_bindControls(['id', 'url', 'filterStatus', 'level', 'description']);
        	var id = '${param.id}';
        	if (typeof(id) != "undefined" && id != null && id.trim() != "") {
        		var param = {id:'${param.id}'};
        		// _loadData为加载当前页面需要数据，得到的数据会显示在_bindControls绑定的控件中
        		// 其中url为加载数据的路径，param为加载数据需要的参数，第三个参数为对加载的数据进行处理
        		// 当加载数据得到的值中属性名与_bindControls绑定的控件ID一致时可无需传此参数
        		_loadData(m_res_find_url, param, function(data) {
            		$('#id').val(data.id);
            		$('#url').val(data.url);
            		$('#filterStatus').combobox('setValue', data.filterStatus);
            		$('#level').combobox('setValue', data.level);
            		$('#description').val(data.description);
        		});
            }
        });
        function f_submit() {
       		// 提交页面数据到指定URL，参数为url，_bindControls绑定的控件的值会提交到该url
       		var param = new Object();
       		param.id = $('#id').val();
       		param.url = $('#url').val();
       		param.filterStatus = $('#filterStatus').combobox('getValue');
       		param.level = $('#level').combobox('getValue');
       		param.description = $('#description').val();
            _submitChange(m_res_saveOrUpdate_url, param, true);
        }
    </script>
</head>
<body style="padding: 10px">
<form id="save_or_update_form" method="post">
	<input id="id" type="hidden" name="id" value="${param.id}"/>
	<table cellpadding="0" cellspacing="10" class="l-table-edit">
		<tr>
			<td align="right">资源路径:</td>
			<td align="left"><input id="url" type="text" name="url" class="easyui-validatebox" style="width:160px" required="true"/></td>
		</tr>
		<tr>
			<td align="right">访问过滤:</td>
			<td align="left"><select id="filterStatus" editable="false" name="filterStatus" defaultValue="-1" style="width:160px" class="easyui-combobox">
				<option value="-1">已登陆用户可以访问</option>
				<option value="0">任意用户可以访问</option>
				<option value="1">通过权限验证可以访问</option>
			</select>
			</td>
		</tr>
		<tr>
			<td align="right">资源级别:</td>
			<td align="left"><select id="level" name="level" editable="false" defaultValue="1" style="width:160px" class="easyui-combobox">
				<option value="-1">系统级别</option>
				<option value="0" selected>用户级别</option>
			</select>
			</td>
		</tr>
		<tr>
			<td align="right">资源描述:</td>
			<td align="left"><input id="description" type="text" style="width:160px" name="description"/></td>
		</tr>
		<tr>
			<td></td>
			<td><a href="#" id="submitBtn" class="easyui-linkbutton" iconCls="icon-ok" style="padding-left:5px;" onclick="f_submit()">提交</a>
			<a href="#" id="resetBtn" class="easyui-linkbutton" align="right" iconCls="icon-cancel" onclick="_resetChange()">重置</a></td>
		</tr>
	</table>
</form>
</body>
</html>